#include "pch.h"
#include "CppUnitTest.h"
#include "../sudoku/test.h"

using namespace Microsoft::VisualStudio::CppUnitTestFramework;

namespace UnitTest
{
	TEST_CLASS(UnitTest)
	{
	public:
		TEST_METHOD(unittest_f1)
		{
			int argc = 5;
			char* argv[10];
			argv[1] = "-#";
			argv[2] = "10";
			argv[3] = "-m";
			argv[4] = "2";
			Assert::AreEqual(1, test(argc, argv));
		}

		TEST_METHOD(unittest_f2)
		{
			int argc = 1;
			char* argv[10];
			Assert::AreEqual(1, test(argc, argv));
		}

		TEST_METHOD(unittest_c1)
		{
			int argc = 3;
			char* argv[10];
			argv[1] = "-c";
			argv[2] = "0";
			Assert::AreEqual(1, test(argc, argv));
		}
		TEST_METHOD(unittest_c2)
		{
			int argc = 3;
			char* argv[10];
			argv[1] = "-c";
			argv[2] = "100";
			Assert::AreEqual(0, test(argc, argv));
		}
		TEST_METHOD(unittest_c3)
		{
			int argc = 3;
			char* argv[10];
			argv[1] = "-c";
			argv[2] = "2000000";
			Assert::AreEqual(1, test(argc, argv));
		}

		TEST_METHOD(unittest_s_10)
		{
			int argc = 3;
			char* argv[10];
			argv[1] = "-s";
			argv[2] = "C:/Users/86158/Desktop/sudoku/game10.txt";
			Assert::AreEqual(0, test(argc, argv));
		}

		TEST_METHOD(unittest_s_100)
		{
			int argc = 3;
			char* argv[10];
			argv[1] = "-s";
			argv[2] = "C:/Users/86158/Desktop/sudoku/game100.txt";
			Assert::AreEqual(0, test(argc, argv));
		}

		TEST_METHOD(unittest_s_1000)
		{
			int argc = 3;
			char* argv[10];
			argv[1] = "-s";
			argv[2] = "C:/Users/86158/Desktop/sudoku/game1000.txt";
			Assert::AreEqual(0, test(argc, argv));
		}

		TEST_METHOD(unittest_s_error)
		{
			int argc = 3;
			char* argv[10];
			argv[1] = "-s";
			argv[2] = "C:/Users/86158/Desktop/sudoku/game_error.txt";
			Assert::AreEqual(0, test(argc, argv));
		}

		TEST_METHOD(unittest_n1)
		{
			int argc = 3;
			char* argv[10];
			argv[1] = "-n";
			argv[2] = "1000";
			Assert::AreEqual(0, test(argc, argv));
		}

		TEST_METHOD(unittest_n2)
		{
			int argc = 3;
			char* argv[10];
			argv[1] = "-n";
			argv[2] = "20000";
			Assert::AreEqual(1, test(argc, argv));
		}

		TEST_METHOD(unittest_m1)
		{
			int argc = 5;
			char* argv[10];
			argv[1] = "-n";
			argv[2] = "10";
			argv[3] = "-m";
			argv[4] = "0";
			Assert::AreEqual(1, test(argc, argv));
		}

		TEST_METHOD(unittest_m2)
		{
			int argc = 5;
			char* argv[10];
			argv[1] = "-n";
			argv[2] = "10";
			argv[3] = "-m";
			argv[4] = "1";
			Assert::AreEqual(0, test(argc, argv));
		}

		TEST_METHOD(unittest_m3)
		{
			int argc = 5;
			char* argv[10];
			argv[1] = "-n";
			argv[2] = "10";
			argv[3] = "-m";
			argv[4] = "2";
			Assert::AreEqual(0, test(argc, argv));
		}
		TEST_METHOD(unittest_m4)
		{
			int argc = 5;
			char* argv[10];
			argv[1] = "-n";
			argv[2] = "10";
			argv[3] = "-m";
			argv[4] = "3";
			Assert::AreEqual(0, test(argc, argv));
		}

		TEST_METHOD(unittest_r1)
		{
			int argc = 5;
			char* argv[10];
			argv[1] = "-n";
			argv[2] = "20";
			argv[3] = "-r";
			argv[4] = "10~15";
			Assert::AreEqual(1, test(argc, argv));
		}
		TEST_METHOD(unittest_r2)
		{
			int argc = 5;
			char* argv[10];
			argv[1] = "-n";
			argv[2] = "20";
			argv[3] = "-r";
			argv[4] = "60~70";
			Assert::AreEqual(1, test(argc, argv));
		}
		TEST_METHOD(unittest_r3)
		{
			int argc = 5;
			char* argv[10];
			argv[1] = "-n";
			argv[2] = "20";
			argv[3] = "-r";
			argv[4] = "25~50";
			Assert::AreEqual(0, test(argc, argv));
		}

		TEST_METHOD(unittest_r4)
		{
			int argc = 5;
			char* argv[10];
			argv[1] = "-n";
			argv[2] = "20";
			argv[3] = "-r";
			argv[4] = "30";
			Assert::AreEqual(1, test(argc, argv));
		}

		TEST_METHOD(unittest_u_5)
		{
			int argc = 4;
			char* argv[10];
			argv[1] = "-n";
			argv[2] = "5";
			argv[3] = "-u";
			Assert::AreEqual(0, test(argc, argv));
		}

		TEST_METHOD(unittest_u_20)
		{
			int argc = 4;
			char* argv[10];
			argv[1] = "-n";
			argv[2] = "20";
			argv[3] = "-u";
			Assert::AreEqual(0, test(argc, argv));
		}

		TEST_METHOD(unittest_u_100)
		{
			int argc = 4;
			char* argv[10];
			argv[1] = "-n";
			argv[2] = "100";
			argv[3] = "-u";
			Assert::AreEqual(0, test(argc, argv));
		}

		TEST_METHOD(unittest_u_1000)
		{
			int argc = 4;
			char* argv[10];
			argv[1] = "-n";
			argv[2] = "1000";
			argv[3] = "-u";
			Assert::AreEqual(0, test(argc, argv));
		}
	};
}
